Change in openvpn[master]: Split init_key_ctx_bi into send/recv init
A message that is not in the archive (sent off-list or not yet received): gerrit.1731290343000.If9e029bdac264dcc05b2d256c4d323315904a92b@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/799?usp=email
to review the following change.
Change subject: Split init_key_ctx_bi into send/recv init
......................................................................
Split init_key_ctx_bi into send/recv init
This allows for only initialising one of the keys. This is needed for epoch keys where key rotation of send/recv key can happen at different time points.
---
M src/openvpn/crypto.c
M src/openvpn/crypto.h
2 files changed, 38 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/799/1
src/openvpn/crypto.c +25 -4
@@ -939,8 +939,8 @@ }void -init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, -int key_direction,const struct key_type *kt,const char *name) +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) {char log_prefix[128 ] = {0 };struct key_direction_state kds;
@@ -948,13 +948,32 @@key_direction_state_init (&kds, key_direction);snprintf (log_prefix,sizeof (log_prefix),"Outgoing %s" , name); -init_key_ctx (&ctx->encrypt, &key2->keys[kds.out_key], kt, +init_key_ctx (ctx, &key2->keys[kds.out_key], kt,OPENVPN_OP_ENCRYPT , log_prefix); +} + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +char log_prefix[128 ] = {0 }; +struct key_direction_state kds; + +key_direction_state_init (&kds, key_direction); +snprintf (log_prefix,sizeof (log_prefix),"Incoming %s" , name); -init_key_ctx (&ctx->decrypt, &key2->keys[kds.in_key], kt, +init_key_ctx (ctx, &key2->keys[kds.in_key], kt,OPENVPN_OP_DECRYPT , log_prefix); +} + +void +init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +init_key_bi_ctx_send (&ctx->encrypt, key2, key_direction, kt, name); +init_key_bi_ctx_recv (&ctx->decrypt, key2, key_direction, kt, name); ctx->initialized = true; }
@@ -972,6 +991,8 @@hmac_ctx_free (ctx->hmac); ctx->hmac =NULL ; } +CLEAR (ctx->implicit_iv); + ctx->plaintext_blocks =0 ; }void
src/openvpn/crypto.h +13 -1
@@ -189,7 +189,9 @@int n;/**< The number of \c key objects stored * in the \c key2.keys array. */ struct key keys[2 ];/**< Two unidirectional sets of %key -* material. */ +* material. The first key is the client +* (encrypts) to server (decrypts), the +* second the server to client key. */ };/**
@@ -342,6 +344,16 @@ const struct key_type *kt, int enc, const char *prefix); +void +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); +void free_key_ctx (struct key_ctx *ctx); void init_key_ctx_bi(struct key_ctx_bi *ctx, const struct key2 *key2,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/799?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If9e029bdac264dcc05b2d256c4d323315904a92b
Gerrit-Change-Number: 799
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/799?usp=email )
Change subject: Split init_key_ctx_bi into send/recv init
......................................................................
Patch Set 8: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/799?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If9e029bdac264dcc05b2d256c4d323315904a92b
Gerrit-Change-Number: 799
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sat, 21 Dec 2024 22:34:39 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v8 1/1 Split init_key_ctx_bi into send/recv init
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
This allows for only initialising one of the keys. This is needed for epoch keys where key rotation of send/recv key can happen at different time points.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/799
This mail reflects revision 8 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/crypto.c +25 -4
@@ -947,8 +947,8 @@ }void -init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, -int key_direction,const struct key_type *kt,const char *name) +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) {char log_prefix[128 ] = {0 };struct key_direction_state kds;
@@ -956,13 +956,32 @@key_direction_state_init (&kds, key_direction);snprintf (log_prefix,sizeof (log_prefix),"Outgoing %s" , name); -init_key_ctx (&ctx->encrypt, &key2->keys[kds.out_key], kt, +init_key_ctx (ctx, &key2->keys[kds.out_key], kt,OPENVPN_OP_ENCRYPT , log_prefix); +} + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +char log_prefix[128 ] = {0 }; +struct key_direction_state kds; + +key_direction_state_init (&kds, key_direction); +snprintf (log_prefix,sizeof (log_prefix),"Incoming %s" , name); -init_key_ctx (&ctx->decrypt, &key2->keys[kds.in_key], kt, +init_key_ctx (ctx, &key2->keys[kds.in_key], kt,OPENVPN_OP_DECRYPT , log_prefix); +} + +void +init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +init_key_bi_ctx_send (&ctx->encrypt, key2, key_direction, kt, name); +init_key_bi_ctx_recv (&ctx->decrypt, key2, key_direction, kt, name); ctx->initialized = true; }
@@ -980,6 +999,8 @@hmac_ctx_free (ctx->hmac); ctx->hmac =NULL ; } +CLEAR (ctx->implicit_iv); + ctx->plaintext_blocks =0 ; }void
src/openvpn/crypto.h +13 -1
@@ -198,7 +198,9 @@int n;/**< The number of \c key objects stored * in the \c key2.keys array. */ struct key keys[2 ];/**< Two unidirectional sets of %key -* material. */ +* material. The first key is the client +* (encrypts) to server (decrypts), the +* second the server to client key. */ };/**
@@ -351,6 +353,16 @@ const struct key_type *kt, int enc, const char *prefix); +void +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); +void free_key_ctx (struct key_ctx *ctx); void init_key_ctx_bi(struct key_ctx_bi *ctx, const struct key2 *key2,
[Openvpn-devel] [PATCH applied] Re: Split init_key_ctx_bi into send/recv init
This is a fairly straightforward and mechanical change, so easy to review (still fed to the full client/server testbed, just to be sure).
Your patch has been applied to the master branch.
commit 435cc9a7535c86c1ab513ae106895960c183095e
Author: Arne Schwabe Date: Sat Dec 21 23:39:05 2024 +0100
Split init_key_ctx_bi into send/recv init
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30151.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#9) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/799?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Split init_key_ctx_bi into send/recv init
......................................................................
Split init_key_ctx_bi into send/recv init
This allows for only initialising one of the keys. This is needed for epoch keys where key rotation of send/recv key can happen at different time points.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30151.html
---
M src/openvpn/crypto.c
M src/openvpn/crypto.h
2 files changed, 38 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/799/9
src/openvpn/crypto.c +25 -4
@@ -938,8 +938,8 @@ }void -init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, -int key_direction,const struct key_type *kt,const char *name) +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) {char log_prefix[128 ] = {0 };struct key_direction_state kds;
@@ -947,13 +947,32 @@key_direction_state_init (&kds, key_direction);snprintf (log_prefix,sizeof (log_prefix),"Outgoing %s" , name); -init_key_ctx (&ctx->encrypt, &key2->keys[kds.out_key], kt, +init_key_ctx (ctx, &key2->keys[kds.out_key], kt,OPENVPN_OP_ENCRYPT , log_prefix); +} + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +char log_prefix[128 ] = {0 }; +struct key_direction_state kds; + +key_direction_state_init (&kds, key_direction); +snprintf (log_prefix,sizeof (log_prefix),"Incoming %s" , name); -init_key_ctx (&ctx->decrypt, &key2->keys[kds.in_key], kt, +init_key_ctx (ctx, &key2->keys[kds.in_key], kt,OPENVPN_OP_DECRYPT , log_prefix); +} + +void +init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +init_key_bi_ctx_send (&ctx->encrypt, key2, key_direction, kt, name); +init_key_bi_ctx_recv (&ctx->decrypt, key2, key_direction, kt, name); ctx->initialized = true; }
@@ -971,6 +990,8 @@hmac_ctx_free (ctx->hmac); ctx->hmac =NULL ; } +CLEAR (ctx->implicit_iv); + ctx->plaintext_blocks =0 ; }void
src/openvpn/crypto.h +13 -1
@@ -196,7 +196,9 @@int n;/**< The number of \c key objects stored * in the \c key2.keys array. */ struct key keys[2 ];/**< Two unidirectional sets of %key -* material. */ +* material. The first key is the client +* (encrypts) to server (decrypts), the +* second the server to client key. */ };/**
@@ -349,6 +351,16 @@ const struct key_type *kt, int enc, const char *prefix); +void +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); +void free_key_ctx (struct key_ctx *ctx); void init_key_ctx_bi(struct key_ctx_bi *ctx, const struct key2 *key2,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/799?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If9e029bdac264dcc05b2d256c4d323315904a92b
Gerrit-Change-Number: 799
Gerrit-PatchSet: 9
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/799?usp=email )
Change subject: Split init_key_ctx_bi into send/recv init
......................................................................
Split init_key_ctx_bi into send/recv init
This allows for only initialising one of the keys. This is needed for epoch keys where key rotation of send/recv key can happen at different time points.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30151.html
---
M src/openvpn/crypto.c
M src/openvpn/crypto.h
2 files changed, 38 insertions(+), 5 deletions(-)
src/openvpn/crypto.c +25 -4
@@ -938,8 +938,8 @@ }void -init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, -int key_direction,const struct key_type *kt,const char *name) +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) {char log_prefix[128 ] = {0 };struct key_direction_state kds;
@@ -947,13 +947,32 @@key_direction_state_init (&kds, key_direction);snprintf (log_prefix,sizeof (log_prefix),"Outgoing %s" , name); -init_key_ctx (&ctx->encrypt, &key2->keys[kds.out_key], kt, +init_key_ctx (ctx, &key2->keys[kds.out_key], kt,OPENVPN_OP_ENCRYPT , log_prefix); +} + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +char log_prefix[128 ] = {0 }; +struct key_direction_state kds; + +key_direction_state_init (&kds, key_direction); +snprintf (log_prefix,sizeof (log_prefix),"Incoming %s" , name); -init_key_ctx (&ctx->decrypt, &key2->keys[kds.in_key], kt, +init_key_ctx (ctx, &key2->keys[kds.in_key], kt,OPENVPN_OP_DECRYPT , log_prefix); +} + +void +init_key_ctx_bi (struct key_ctx_bi *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt,const char *name) +{ +init_key_bi_ctx_send (&ctx->encrypt, key2, key_direction, kt, name); +init_key_bi_ctx_recv (&ctx->decrypt, key2, key_direction, kt, name); ctx->initialized = true; }
@@ -971,6 +990,8 @@hmac_ctx_free (ctx->hmac); ctx->hmac =NULL ; } +CLEAR (ctx->implicit_iv); + ctx->plaintext_blocks =0 ; }void
src/openvpn/crypto.h +13 -1
@@ -196,7 +196,9 @@int n;/**< The number of \c key objects stored * in the \c key2.keys array. */ struct key keys[2 ];/**< Two unidirectional sets of %key -* material. */ +* material. The first key is the client +* (encrypts) to server (decrypts), the +* second the server to client key. */ };/**
@@ -349,6 +351,16 @@ const struct key_type *kt, int enc, const char *prefix); +void +init_key_bi_ctx_send (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); + +void +init_key_bi_ctx_recv (struct key_ctx *ctx,const struct key2 *key2, +int key_direction,const struct key_type *kt, +const char *name); +void free_key_ctx (struct key_ctx *ctx); void init_key_ctx_bi(struct key_ctx_bi *ctx, const struct key2 *key2,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/799?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If9e029bdac264dcc05b2d256c4d323315904a92b
Gerrit-Change-Number: 799
Gerrit-PatchSet: 9
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged